package com.neuedu.myweather;

import org.apache.hadoop.io.WritableComparable;
import org.apache.hadoop.io.WritableComparator;

/**
 * 自定义分区类
 *
 * @author Dell
 */
public class YearGrouping extends WritableComparator {
    protected YearGrouping() {
        super(WeatherWritable.class, true);
    }

    @Override
    public int compare(WritableComparable a, WritableComparable b) {
        WeatherWritable w1 = (WeatherWritable) a;
        WeatherWritable w2 = (WeatherWritable) b;

        return w1.getYear() - w2.getYear();

    }
}
